package com.jason.game.online.home.adapter

import android.content.Context
import android.view.View
import com.cby.library.data.model.GameInfoBean
import com.cby.library.widget.adapter.SimpleBaseAdapter
import android.view.ViewGroup
import android.widget.TextView
import com.cby.library.common.ext.load
import com.cby.library.widget.label.LabelImageView
import com.jason.game.online.R

/**
 * 描述信息
 *
 * @author 徐智伟
 * @create 2018/11/28
 */
class GameGridItem4Adapter(
    context: Context?,
    data: List<GameInfoBean?>?
) : SimpleBaseAdapter<GameInfoBean?>(context, data) {

    override fun getItemResource(): Int {
        return R.layout.item_home_grid_4
    }

    override fun getItemView(
        position: Int, convertView: View, parent: ViewGroup,
        holder: ViewHolder
    ): View {
        val nameTextView: TextView = holder.findView(R.id.tv_game_item_name)
        val iconImageView: LabelImageView = holder.findView(R.id.iv_game_item_icon)
        data[position]?.let {
            nameTextView.text = it.title
            iconImageView.load(it.icon, R.drawable.loading_bixue)
            //设置是否显示图标
            //GameIconLabelUtils.shouldIconLabelVisual(iconImageView, item)
//            ImageUtils.displayRoundImage(
//                iconImageView, item.icon, 6,
//                0, 0, CornerType.TOP, R.drawable.icon_placeholder_square_round_top
//            )
        }

        return convertView
    }
}